package cn.tedu.tw.whr;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppRefField {

    public static void main (String[] args) throws Exception{
        Class<?> C = Class.forName("cn.tedu.tw.whr.Human");
        Object h = C.newInstance();
        Field name = C.getDeclaredField("name");

        name.setAccessible(true);

        name.set(h,"Coco");
        Method getName = C.getMethod("getName");
        Object result = getName.invoke(h);
        System.out.println(result);


    }

}

